export const domain = 'https://safe.kingfox.top/'

export const $post = (Url, params) => {
	return new Promise(function(resolve, reject) {
		uni.request({
			url: domain + "api" + Url,
			data: params,
			method: 'POST',
			dataType: 'json',
			header: {
				"token": uni.getStorageSync('token') || ''
			},
			success: (res) => {
				uni.stopPullDownRefresh()
				uni.hideLoading();
				resolve(res.data)
			},
			fail(err) {
				reject(err)
			},
			complete() {

			}
		});
	})
}

export const $get = (Url, params) => {
	return new Promise(function(resolve, reject) {
		uni.request({
			url: domain + "api" + Url,
			data: params,
			method: 'GET',
			dataType: 'json',
			header: {
				"token": uni.getStorageSync('token') || ''
			},
			success: (res) => {
				uni.stopPullDownRefresh()
				uni.hideLoading();
				resolve(res.data)
			},
			fail(err) {
				reject(err)
			},
			complete() {

			}
		});
	})
}